<template>
  <div class="search-banner">
    <div class="title">{{title}}</div>
    <div class="search-wrapper">
      <i class="fas fa-search search-logo" @click="search()" ></i>
      <input class="search" type="text" :placeholder="placeholderInfo" />
    </div>
  </div>
</template>

<script>
import axios from 'axios'
export default {
    name:'search',
    props:{
        placeholderInfo:{
            type:String
        },
        title:{
            type:String
        },
        url:{
          type:String
        }
    },
    methods:{
      // 搜索功能
      search(){
        if(this.url){
          let text=document.getElementsByClassName("search")[0].value;
          console.log(text);
          axios({
            method:"GET",
            url:this.url
          })
        }else{
          return  
        }
      }
    }
}
</script>
<style>
.search-banner {
  background-image: url(../assets/images/backimg.png);
  height: 250px;
  width: 100%;
  background-position-x: -25px;
  background-position-y: -10px;
  padding-top: 100px;
  text-align: center;
  color: white;
}
.search-banner .title {

  font-size: 30px;
  margin-bottom: 20px;
}
.search-banner .search-wrapper{
    display: inline-block;
    width: 600px;
    position: relative;
    vertical-align: middle;
    line-height: normal;
}
.search-banner .search{
  outline: none;
    display: inline-block;
    width: 98%;
    height: 32px;
    line-height: 1.5;
    padding: 4px 7px;
    font-size: 14px;
    border: 1px solid #dcdee2;
    border-radius: 4px;
    color: #515a6e;
    background-color: #fff;
}
.search-banner .search-logo{
    width: 40px;
    height: 40px;
    line-height: 40px;
    font-size: 16px;
    text-align: center;
    color: #808695;
    position: absolute;
    right: 0;
    top: -3px;
    z-index: 3;
    cursor: pointer;
    transition: color .3s ease-in-out;
}
.search-banner .search-logo:hover{
  color: white;
}
.search-banner .search::-webkit-input-placeholder{
    opacity:0.5
}
</style>